home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
dskut
/
fhard101.zip
/
VHARD.DOC
< prev
next >
Wrap
Text File
|
1990-07-22
|
10KB
|
216 lines
==============================================================================
= =
= VHARD.DOC =
= =
= Documentation for VHARD.SYS and associated utilities =
= =
= Public Domain Software =
= =
= by =
= =
= Aaron L. Brenner =
= July 1990 =
= =
= BIX user albrenner =
= GEnie mail address A.BRENNER =
==============================================================================
=Dedication=
This documentation and all the accompanying software (VHARD.SYS,
VHPREP.EXE, VHCACHE.EXE, and all associated source code) are hereby released
to the public domain.
=Background=
I hate doing backups. Since I don't have a commercial backup program
(and I refuse to use the brain-damaged BACKUP that comes with DOS), I have to
split large files to fit on my 360KB diskettes. That gets to be a real pain.
One day, I got an idea: how about a device driver that makes my A:
drive look like a small (and very slow) hard disk? It would allow me to easily
backup those big files without the hassle of manually splitting them up. With
that idea in mind, I sat down and wrote VHARD.
=VHARD.SYS=
VHARD.SYS is a device driver that provides another drive to DOS.
Version 1.00 allows for 13 360KB diskettes, giving 5,304,320 bytes of space.
Later versions will allow for different diskette formats.
To install VHARD.SYS, you need to put a line in your CONFIG.SYS like
this
DEVICE=VHARD.SYS
and reboot. At that point, you will have another drive recognized by DOS. You
can copy files to and from the drive, run CHKDSK on the drive, list the
directory of the drive, and so on. As far as DOS is concerned, it's a
removable 5MB disk.
=VHPREP.EXE=
Before you can actually use a set of floppies with VHARD, they must be
prepared by VHPREP. Each floppy will be formatted and stamped with a disk ID
and serial number.
The command syntax for VHPREP is
VHPREP [<disk ID> [<disk number>]]
<disk ID> is an optional 8-character identification tag that will be
put on each diskette in the set.
<disk number> is the optional disk number. It can only be used in
conjuction with the <disk ID> option, and indicates to VHPREP that you
only want to prepare 1 diskette.
If you don't give VHPREP a specific disk ID to use, it will build a
funny-looking one based on the current system time (VH0BF10D, for
instance).
When run, VHPREP will prompt you to put a diskette in drive A:, then
press a key. VHPREP will then format the diskette, and write the disk ID and
disk number. Also, if it is the first disk of the set (disk 0), VHPREP will
also write a DOS boot sector, 2 empty FATs, and a root directory containing
the disk ID as the volume label. Once the diskette has been prepared, VHPREP
will tell you how to label it.
=VHCACHE.EXE=
To minimize floppy-swapping when copying files to the VHARD drive,
VHCACHE provides a read/write cache of the FAT and root directory.
The command syntax for VHCACHE is
VHCACHE [? | INFO | ON | OFF | MANUAL | AUTO | FLUSH]
? and INFO will cause VHCACHE to display information about the cache.
ON will install and enable the cache.
OFF will disable the cache and remove it from memory.
AUTO will cause the cache to be written to disk automatically if the
DOS version is 3.00 or greater AND SHARE is installed. In this case,
DOS will tell the VHARD driver when it is opening and closing files,
so the driver can know when it needs to update the FAT and root
directory.
MANUAL will disable AUTO, forcing you to tell VHARD when to write the
cache to disk.
FLUSH is how you tell VHARD to write the cache to disk.
If you don't give VHCACHE any parameters, it will display a brief
usage message.
* * * * * * * * * * * * * WARNING!!! * * * * * * * * * * * * *
If you intend to run a program that will be using absolute disk
sectors (a defragger, for instance) with the VHARD drive, DISABLE THE
CACHE FIRST! The cache-handling code in VHARD.SYS is *very* simple-
minded. DOS only reads and writes the FATs and root directory a few
sectors (at most) at a time, so VHARD will only work properly if the
data to be read or written fall entirely within or outside tha cache.
This warning applies to reading or writing absolute sectors from
within DEBUG and SYMDEB as well.
If you don't know what I'm talking about, that's all right. Just
remember: if you're going to do something that could be dangerous with
a normal disk, disable the cache first.
=Technical info=
* Each diskette in the set is formatted to 10 sectors per track, 40
tracks, 512 bytes per sector. This gives 799 usable sectors on each
diskette.
* VHARD.SYS actually contains 2 device drivers - a block driver that
provides the support for the virtual hard drive, and a character
driver that provides functions for dealing with the non-standard
diskettes. This driver is named VHARDCTL. The provided source code
fully describes the operation and use of this driver, but I'll repeat
some of it here.
All commands are sent to VHARDCTL via DOS' IOCTL function (44h). The
usual sequence of operations is something like this:
vhctl_name db 'VHARDCTL',0 ; Name of the driver
vhctl_command VH_CMD <> ; Defined in VHARD.INC
our_drive db 0ffh ; Drive assigned (DOS 3.10+)
vhard_version dw 0 ; VHARD.SYS version
vhard_BPB DOS_BPB <> ; Defined in DD_DEFS.INC
. . . . .
mov dx,offset vhctl_name ; Tell DOS to open it
mov ax,3d02 ; for read/write
int 21h ;
jc not_there ; If it fails, driver isn't
; loaded
mov bx,ax ; Get the handle DOS returned
mov ax,4400h ; IOCTL - Get Device Info
int 21h ;
test dl,80h ; Test the "ISDEV" bit
jz not_there ; If it isn't a device, the
; driver isn't loaded
. . . . .
mov vhctl_command.VC_cmd_code,CMD_GETDATA
mov word ptr vhctl_command.VC_buffer[0],offset our_drive
mov word ptr vhctl_command.VC_buffer[2],ds
mov dx,offset vhctl_command ; Data to write (BX = handle)
mov cx,size VH_CMD ; Number of bytes to write
mov ax,4403h ; IOCTL write
int 21h ;
VHARDCTL supports the following commands:
Format T